'''
Author: caoniu caoniu@jushuitan.com
Date: 2023-06-28 23:17:16
LastEditors: caoniu caoniu@jushuitan.com
LastEditTime: 2023-06-28 23:29:25
FilePath: /pdf_knowledge_base/server.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
from fastapi import FastAPI
from fastapi.responses import FileResponse
import uvicorn
from langchain.chat_models import ChatOpenAI

import os
# 配置环境变量
os.environ["OPENAI_API_KEY"] = "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"

app = FastAPI()

@app.post("/ask")
def ask(body: dict):
    result = "hello"
    return result

@app.get("/")
async def homepage():
    return FileResponse(f'{os.getcwd()}/statics/index.html')

if __name__ == "__main__":
    uvicorn.run(host="127.0.0.1", port=8002, app=app)